作业一:最后一个单词长度

  • 姓名:亢晨旭
  • 学号:4201459
In [2]:
f = open("作业一素材.txt",mode="r",encoding="utf-8")
lines = f.readlines()
line = lines[-3]
words = line.split(" ")
word = words[-1]
word = word[0:-2]
x = len(word)
print(x)
6
In [ ]: